package helper

import (
	"os"
	"path/filepath"
	"strings"
)

func GetAppDirectory() (string, error) {
	// 返回app的绝对路径
	//返回绝对路径 filepath.Dir(os.Args[0])去除最后⼀个元素的路径
	dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
	if err != nil {
		return "", err
	}
	//将\替换成/
	return strings.Replace(dir, "\\", "/", -1), nil
}
